$(function () {
    $("#longitude").val($("#longitude").val() / 1000000);
    $("#latitude").val($("#latitude").val() / 1000000);

    $('.shopPhoto').viewer();

    $('#shopCheckSuccess').click(function () {
        $.ajax({
            url: ctx + '/shop/check.do',
            data: {id: $(this).attr("shopId"), checkResult: 1},
            success: function (data) {
                if (data.flag > 0) {
                    shopAuthenticationGrid.bootgrid("reload");
                    alert("审核成功");
                    onTabCloseClick($('#shopCheckSuccess').closest('div.tab-pane').attr('id'));
                } else {
                    alert("审核失败");
                }
            }
        });
    });
    $('#shopCheckFail').click(function () {
        $.ajax({
            url: ctx + '/shop/check.do',
            data: {id: $(this).attr("shopId"), checkResult: 0},
            success: function (data) {
                if (data.flag > 0) {
                    shopAuthenticationGrid.bootgrid("reload");
                    alert("审核成功");
                    console.log($(this).closest('div.tab-pane'));
                    onTabCloseClick($('#shopCheckFail').closest('div.tab-pane').attr('id'));
                } else {
                    alert("审核失败");
                }
            }
        });
    });
});

function mapCallback() {
    var map = new BMap.Map("map");

    map.addControl(new BMap.MapTypeControl());   //添加地图类型控件
    map.addControl(new BMap.NavigationControl());//左上角，添加默认缩放平移控件
    map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
    var point = new BMap.Point($("#longitude").val(), $("#latitude").val());
    map.setCurrentCity($('#province').val());
    map.centerAndZoom(point, 16);
    var marker = new BMap.Marker(point);// 创建标注
    map.addOverlay(marker);// 将标注添加到地图中
}